//
//  HNMyOrderTableCell.m
//  baidaifu
//
//  Created by 朱传正 on 2016/12/30.
//  Copyright © 2016年 haoniu. All rights reserved.
//

#import "HNMyOrderTableCell.h"

@implementation HNMyOrderTableCell


- (IBAction)deleteAction:(UIButton *)sender {
    
    [self.MyOrderCellDelegate HNMyOrderTableCell:self deleteIndexPath:_indexPath];
}


- (IBAction)payAction:(UIButton *)sender {
    [self.MyOrderCellDelegate HNMyOrderTableCell:self payIndexPath: _indexPath];
}

- (IBAction)pushDevileryAction:(UIButton *)sender {
    [self.MyOrderCellDelegate HNMyOrderTableCell:self pushDeliveryIndexPath:_indexPath];
}


- (IBAction)contactSeiviceAction:(UIButton *)sender {
    [self.MyOrderCellDelegate HNMyOrderTableCell:self contectServiceIndexPath:_indexPath];
}


- (IBAction)sureAction:(UIButton *)sender {
    [self.MyOrderCellDelegate HNMyOrderTableCell:self sureIndexPath:_indexPath];
}


- (IBAction)viewLogistics:(UIButton *)sender {
    [self.MyOrderCellDelegate HNMyOrderTableCell:self viewLogisticsIndexPath:_indexPath];
}






- (void)awakeFromNib {
    [super awakeFromNib];
    
    //设置按钮的边界颜色
    CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
    CGColorRef color = CGColorCreate(colorSpaceRef, (CGFloat[]){164.0/255.0,164.0/255.0,164.0/255.0,1});
    [_deletaBtn.layer setMasksToBounds:YES];
    [_deletaBtn.layer setCornerRadius:3];
    [_deletaBtn.layer setBorderWidth:1];//设置边界的宽度
    [_deletaBtn.layer setBorderColor:color];
    [_deletaBtn setHidden:YES];
    
    
    [_payBtn.layer setMasksToBounds:YES];
    [_payBtn.layer setCornerRadius:3];
    [_payBtn.layer setBorderWidth:1];//设置边界的宽度
    [_payBtn.layer setBorderColor:color];
     [_payBtn setHidden:YES];
    
    [_pushDevileryBtn.layer setMasksToBounds:YES];
    [_pushDevileryBtn.layer setCornerRadius:3];
    [_pushDevileryBtn.layer setBorderWidth:1];//设置边界的宽度
    [_pushDevileryBtn.layer setBorderColor:color];
     [_pushDevileryBtn setHidden:YES];
    
    [_contactServiceBtn.layer setMasksToBounds:YES];
    [_contactServiceBtn.layer setCornerRadius:3];
    [_contactServiceBtn.layer setBorderWidth:1];//设置边界的宽度
    [_contactServiceBtn.layer setBorderColor:color];
     [_contactServiceBtn setHidden:YES];
    
    [_sureBtn.layer setMasksToBounds:YES];
    [_sureBtn.layer setCornerRadius:3];
    [_sureBtn.layer setBorderWidth:1];//设置边界的宽度
    [_sureBtn.layer setBorderColor:color];
     [_sureBtn setHidden:YES];
    
    [_viewLogisticsBtn.layer setMasksToBounds:YES];
    [_viewLogisticsBtn.layer setCornerRadius:3];
    [_viewLogisticsBtn.layer setBorderWidth:1];//设置边界的宽度
    [_viewLogisticsBtn.layer setBorderColor:color];
     [_viewLogisticsBtn setHidden:YES];
    
    [_viewLogisticsBtn2.layer setMasksToBounds:YES];
    [_viewLogisticsBtn2.layer setCornerRadius:3];
    [_viewLogisticsBtn2.layer setBorderWidth:1];//设置边界的宽度
    [_viewLogisticsBtn2.layer setBorderColor:color];
     [_viewLogisticsBtn2 setHidden:YES];
 
  
}


-(void)setBtnState:(NSInteger )state{
    
    
    NSLog(@"%ld",state);
    
    switch (state) {
        case 0:
            [_deletaBtn setHidden:NO];
            [_payBtn setHidden:NO];
            [_cellState setText:@"待付款"];
            break;
        case 1:
            [_contactServiceBtn setHidden:NO];
            [_pushDevileryBtn setHidden:NO];
             [_cellState setText:@"已付款"];
            break;
            
        case 21:
            [_viewLogisticsBtn setHidden:NO];
            [_contactServiceBtn setHidden:NO];
            [_sureBtn setHidden:NO];
              [_cellState setText:@"已发货"];
            break;
            
        case 22:
            [_contactServiceBtn setHidden:NO];
            [_viewLogisticsBtn2 setHidden:NO];
             [_cellState setText:@"已收货"];
            break;
        default:
            break;
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
